// 图片URL数组
const imageUrls = [
    './imgs/tg_clients_1.gif',
    './imgs/tg_clients_2.gif',
    './imgs/tg_clients_3.gif',
    './imgs/tg_clients_4.gif',
    './imgs/tg_clients_5.gif',
    './imgs/tg_clients_6.gif',
    './imgs/tg_clients_7.gif',
    './imgs/tg_clients_8.gif',
    './imgs/tg_clients_9.gif',
    './imgs/tg_clients_10.gif',
    './imgs/tg_clients_11.gif',
    './imgs/tg_clients_12.gif',
    './imgs/tg_clients_13.gif',
    './imgs/tg_clients_14.gif',
    './imgs/tg_clients_15.gif',
    './imgs/tg_clients_16.gif',
    './imgs/tg_clients_17.gif',
    './imgs/tg_clients_18.gif'
];

// 获取ul元素
const ul = document.getElementById('image-list');

// 遍历图片URL数组，并创建对应的<li>和<img>元素
imageUrls.forEach(function (url) {
    // 创建<li>元素
    const li = document.createElement('li');

    // 创建<img>元素，并设置其src属性为当前的url
    const img = document.createElement('img');
    img.src = url;
    img.alt = 'Image'; // 设置alt文本以提高可访问性

    // 将<img>添加到<li>中
    li.appendChild(img);

    // 将<li>添加到<ul>中
    ul.appendChild(li);
});

// 处理每个服务项的替代内容
document.querySelectorAll('.service-item').forEach(item => {
    const altImg = item.getAttribute('data-alt-img');
    const altTitle = item.getAttribute('data-alt-title');
    const altDesc = item.getAttribute('data-alt-desc');

    // 创建替代内容容器
    const altContent = document.createElement('div');
    altContent.className = 'alt-content';

    // 创建并添加替代图片
    const altIcon = document.createElement('img');
    altIcon.src = altImg;
    altIcon.alt = 'Alternative Image';
    altIcon.className = 'service-icon';
    altContent.appendChild(altIcon);

    // 创建并添加替代标题
    const altTitleElement = document.createElement('h3');
    altTitleElement.textContent = altTitle;
    altTitleElement.className = 'service-title';
    altContent.appendChild(altTitleElement);

    // 创建并添加替代描述
    const altDescElement = document.createElement('p');
    altDescElement.textContent = altDesc;
    altDescElement.className = 'service-desc';
    altContent.appendChild(altDescElement);

    // 将替代内容添加到服务项中
    item.appendChild(altContent);
});